package com.example.myspring;

import org.apache.log4j.Logger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import zipkin.server.EnableZipkinServer;

@SpringBootApplication
@EnableDiscoveryClient
@RestController
@EnableZipkinServer 
public class MyspringApplication {

	private final Logger logger = Logger.getLogger(getClass());

	public static void main(String[] args) {
		SpringApplication.run(MyspringApplication.class, args);
	}

	@Bean
	@LoadBalanced
	RestTemplate getRestTemplate(){
		return new RestTemplate();
	}

	/*@RequestMapping(value="/testZipkin",method = RequestMethod.GET)
	public String trace333(){
		logger.info("====call zipkin-server-1 =====");
		return getRestTemplate().getForObject("http://mybatis-service/trace-2", String.class);
	}*/
}
